/**
 * 
 */
package com.gcb.service.impl;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.gcb.domain.Channel;
import com.gcb.domain.ChannelExt;
import com.gcb.repository.ChannelExtRepository;
import com.gcb.repository.ChannelRepository;
import com.gcb.service.ChannelExtService;
import com.gcb.service.ChannelService;

/**
 * @author Cre.Gu
 * 
 */
@Service
public class ChannelServiceImpl implements ChannelService {
	protected static final org.slf4j.Logger log = org.slf4j.LoggerFactory
			.getLogger(EmployeeServiceImpl.class);

	@Resource
	private ChannelRepository channelRepository;
	@Resource
	private ChannelExtRepository channelExtRepository;
	@Resource
	private ChannelExtService channelExtService;

	@Override
	public void save() {
		Channel channel = Channel.create();
		ChannelExt channelExt = ChannelExt.create();

		channel.setChannelExt(channelExt);

		channelRepository.save(channel);
		channelExt.setId(channel.getId());
		//channelExtRepository.save(channelExt);
		
		System.out.println(channel);
	}

	@Override
	public void save2() {
		Channel channel = Channel.create();
		ChannelExt channelExt = ChannelExt.create();

		channel.setChannelExt(channelExt);

		channelRepository.save(channel);
		
		channelExtService.save(channelExt, channel);
		System.out.println(channel);
	}

}
